<?php

namespace app\common\model;

class MallCommissionLevel extends TimeModel
{
    /**
     * 指定分销商信息
     * @param $level
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getlevelInfo($level){
        return $this->field('*')->where("id",$level)->find();
    }

    /**
     * 查询所有分销商等级
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getLevels(){
        return $this->field('*')->select()->order('id desc')->toArray();
    }
}